package com.heima.comment.contorller.v1;

import com.heima.comment.dtos.CommentRepayDto;
import com.heima.comment.dtos.CommentRepayLikeDto;
import com.heima.comment.dtos.CommentRepayListDto;
import com.heima.comment.service.CommentRepayService;
import com.heima.model.common.dtos.ResponseResult;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 评论回复
 */
@RestController
@RequestMapping("/api/v1/comment_repay")
public class CommentRepayController {

    @Autowired
    private CommentRepayService commentRepayService;

    /**
     * 评论回复列表加载
     * @param dto
     * @return
     */
    @PostMapping("/load")
    public ResponseResult load(@RequestBody CommentRepayListDto dto){
        return commentRepayService.load(dto);
    }

    /**
     * 评论的回复
     * @param dto
     * @return
     */
    @PostMapping("/save")
    public ResponseResult saveCommentRepay(@RequestBody CommentRepayDto dto){
        return commentRepayService.saveCommentRepay(dto);
    }

    /**
     * 对评论的回复进行点赞
     * @param dto
     * @return
     */
    @PostMapping("/like")
    public ResponseResult likeCommentRepay(@RequestBody CommentRepayLikeDto dto){
        return commentRepayService.likeCommentRepay(dto);
    }
}
